package cn.hls.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

/**
  *@fileName: Goods.java
  *@package: cn.hls.entity
　*@ Description:货物实体类
　*@author: uuhui@163.com
  *@date: 2016年6月9日
 *
 */
@Entity
@Table(name="t_goods")
@DynamicInsert
@DynamicUpdate
public class Goods extends BaseEntity {
	private static final long serialVersionUID = 2832043686843382364L;
	private String code;// 代码
	private String name;// 名称
	private GoodsCategory category;// 货物类型　
	private String rule;// 规格
	private String emergencyPlan;// 应急方案
	private SafetyCard safetyCard;// 货物安全卡
	private String remark;// 备注
	@Column(name="code",length=16)
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name="name",length=64)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne(cascade = CascadeType.REFRESH)
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "category_id")
	public GoodsCategory getCategory() {
		return category;
	}

	public void setCategory(GoodsCategory category) {
		this.category = category;
	}

	@Column(name="rule",length=512)
	public String getRule() {
		return rule;
	}

	public void setRule(String rule) {
		this.rule = rule;
	}

	@Column(name="emergency_plan",length=512)
	public String getEmergencyPlan() {
		return emergencyPlan;
	}

	public void setEmergencyPlan(String emergencyPlan) {
		this.emergencyPlan = emergencyPlan;
	}

	@ManyToOne(cascade = CascadeType.REFRESH)
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "safetyCard_id")
	public SafetyCard getSafetyCard() {
		return safetyCard;
	}

	public void setSafetyCard(SafetyCard safetyCard) {
		this.safetyCard = safetyCard;
	}

	@JsonIgnore
	@Column(name="remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

}
